 /**
 * @fileoverview load tmpl
 */

(function($) {
	$.extend({
		loadTmpl: function(name) {
			return !this.forceLoad && $.template[name] ||
			$("#" + name).size() > 0 && $.template(name, $("#" + name)) ||
			(function() {
				var tmpl;
				$.ajax(path + "/resources/tmpl/" + name + ".tmpl",{
					success: function(text) {
						tmpl = $.template(name, text);
					},
					dataType: "html",
					async: false
				});
				return tmpl;
			})();
		},
		renderTmpl: function(name, data) {
			return $.tmpl($.loadTmpl(name), data);
		},
		forceLoad: true
	});
})(jQuery);
